/* 移入事件 */
        var catalog = document.getElementById("catalog");

        var allMoves = document.getElementsByClassName("move");

        for (var i = 0; i < allMoves.length; i++) {
            allMoves[i].onmouseover = function () {
                this.lastElementChild.style.display = "block";
                var moveIndex = getIndex(this)
                changePStyleByIndex(moveIndex);
                allMoves[moveIndex].firstElementChild.className = "after active";
                allMoves[0].firstElementChild.className = "after active";
            }
            allMoves[i].onmouseout = function () {
                this.lastElementChild.style.display = "none";
                var moveIndex = getIndex(this);
                allMoves[moveIndex].firstElementChild.className = "after";
                allMoves[0].firstElementChild.className = "after active"
            }

        }

        
        function getIndex(t){
            for(var i = 0;i<allMoves.length;i++){
                var index = -1;
                if(allMoves[i]==t){
                    index = i;
                    break;
                }
            }return index;
        }



        function changePStyleByIndex(n){
            for(var i = 0;i < allMoves.length;i++){
                if(i == n){
                    allMoves[i].firstElementChild.className = "after active";
                }else{
                    allMoves[i].firstElementChild.className = "after";
                }
                allMoves[0].firstElementChild.className = "after active"
            }
        }


        var address = document.getElementById("address")
        var address1 = address.getElementsByClassName("address")
        address.onmousemove = function(){
            address.lastElementChild.style.display = "block";
            address1[0].firstElementChild.style.borderTop = "8px solid #059FFF"
        }
        address.onmouseout = function(){
            address.lastElementChild.style.display = "none";
            address1[0].firstElementChild.style.borderTop = "8px solid white"
        }


/* 轮播图 */
var ad = document.getElementById("ad");
 
var allLis = ad.getElementsByClassName("reason");
var allSpans = document.getElementsByClassName("childSpan");

var liNum = 0;

    var interval;
function time (){
     interval=setInterval(function(){
        if(liNum == 3){
            liNum = 0;
            allLis[3].classList.remove("newAd");
            allLis[0].classList.add("newAd");
            changeListBySpanIndex(0);
        }else{
            liNum++;
        }
        allLis[liNum-1].classList.remove("newAd");
        allLis[liNum].classList.add("newAd");
        changeListBySpanIndex(liNum);
    }
        ,3500)
        return interval;
}
time();

//自动轮播

for(var i = 0; i < allSpans.length;i++){
    allSpans[i].onmousemove = function(){
        var spanIndex = getSpanIndex(this);

        allLis[0].classList.remove("newAd");
        allLis[1].classList.remove("newAd");
        allLis[2].classList.remove("newAd");
        allLis[3].classList.remove("newAd");
        allLis[spanIndex].classList.add("newAd");
        changeListBySpanIndex(spanIndex);
        clearInterval(interval);
        liNum = spanIndex;    
    }
    allSpans[i].onmouseout = function(){
        time();
    }
}

for(var i = 0;i < allLis.length;i++){
    allLis[i].onmouseover=function(){
        clearInterval(interval)
    }
    allLis[i].onmouseout=function(){
        time();
    }
}

    function getSpanIndex(t){
        for(var i = 0;i < allSpans.length;i++){
            var spanTndex=-1;
            if(allSpans[i] == t){
                spanTndex = i;
                break;
            }
        }return spanTndex;
    }

    function changeListBySpanIndex(n){
        for(var i = 0;i<allSpans.length;i++){
            if(i == n){
                allSpans[i].className="activeSpan childSpan";
            }else{
                allSpans[i].className="childSpan";
            }
            
        }
    }

  var weixin = document.getElementsByClassName("weixin");
  weixin[0].onmousemove = function(){
      weixin[0].lastElementChild.style.display = "block";
  }
  weixin[0].onmouseout = function(){
    weixin[0].lastElementChild.style.display = "none";
}

var allConsult = document.getElementsByClassName("allConsult");
var allliis = allConsult[0].getElementsByTagName("li");

allliis[0].onmousemove = function(){
    allliis[0].firstElementChild.firstElementChild.src = "..\\cuds\\images\\qq1.png";
    allliis[0].className = "qq active1"
    allliis[0].lastElementChild.style.display = "block"
}
allliis[0].onmouseout = function(){
    allliis[0].firstElementChild.firstElementChild.src = "..\\cuds\\images\\qq.png";
    allliis[0].className = "qq";
    allliis[0].lastElementChild.style.display = "none"
}
allliis[1].onmousemove = function(){
    allliis[1].firstElementChild.firstElementChild.src = "..\\cuds\\images\\wechat1.png";
    allliis[1].className = "weixin1 active1"
    allliis[1].lastElementChild.style.display = "block"
}
allliis[1].onmouseout = function(){
    allliis[1].firstElementChild.firstElementChild.src = "..\\cuds\\images\\wechat.png";
    allliis[1].className = "weixin1";
    allliis[1].lastElementChild.style.display = "none"
}
allliis[2].onmousemove = function(){
    allliis[2].firstElementChild.firstElementChild.src = "..\\cuds\\images\\tel1.png";
    allliis[2].className = "tel active1"
    allliis[2].lastElementChild.style.display = "block"
}
allliis[2].onmouseout = function(){
    allliis[2].firstElementChild.firstElementChild.src = "..\\cuds\\images\\tel.png";
    allliis[2].className = "tel";
    allliis[2].lastElementChild.style.display = "none"
}



    var ScrollUp = document.getElementById("ScrollUp");
    window.onscroll =function(){
        var top = document.documentElement.scrollTop||document.body.scrollTop;
        if(top > 50){
            ScrollUp.style.visibility="visible"
        }else{
            ScrollUp.style.visibility="hidden"
        }
    }
    ScrollUp.onclick = function(){
        window.scrollTo({top:0, behavior: "smooth"})
    }
